<template>
  <VChart :options="options" />
</template>

<script setup lang="ts">
import { PropType } from 'vue';
import { ISpec } from '@visactor/vchart';

const props = defineProps({
  data: {
    type: Array,
    default: Array.of([])
  },
  title: {
    type: String,
    default: '统计表'
  }
});

const { data, title } = props;

console.log('统计表' + data);

const options: PropType<ISpec> = {
  type: 'line',
  title: {
    visible: true,
    text: title
  },
  data: {
    values: data
  },
  xField: 'day',
  yField: 'num',
  line: {
    style: {
      curveType: 'monotone'
    }
  }
};
</script>
